package com.hzu.service.impl;

import java.util.List;

import com.hzu.dao.IBaseDao;
import com.hzu.dao.impl.BaseDao;
import com.hzu.service.IBaseService;
import com.hzu.utils.Page;
import com.hzu.utils.QueryHelper;

public class BaseService<T> implements IBaseService<T>{

	private IBaseDao<T> baseDao;
	

	public IBaseDao<T> getBaseDao() {
		return baseDao;
	}

	public void setBaseDao(IBaseDao<T> baseDao) {
		this.baseDao = baseDao;
	}

	@Override
	public void save(T entity) {
		baseDao.save(entity);
	}

	@Override
	public void update(T entity) {
		baseDao.update(entity);
	}

	@Override
	public void delete(Integer id) {
		baseDao.delete(id);
	}

	@Override
	public T findObjectById(Integer id) {
		return baseDao.findById(id);
	}

	@Override
	public List<T> findObjects() {
		return baseDao.getAll();
	}

	@Override
	public Page<T> getPageResult(QueryHelper queryHelper, Page<T> page) {
		return baseDao.getByPage(queryHelper, page);
	}


}
